package com.cl.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cl.entity.Resume;
import com.cl.entity.TempResume;
import com.cl.service.PersonResumeService;

 
@Controller
public class PersonController {
	 @Autowired 
     private PersonResumeService prs;
	
	/**
	 * @param EnterpriseAnnounce
	 * 保存职位发布信息到数据库
	 * 方法名规法为业务名
	 * @result String 发布结果
	 * **/
	@RequestMapping(value="resume_posting",produces = "application/json;charset=UTF-8")
	public @ResponseBody String jobPosting(@RequestBody  TempResume tr ){
		
		// tempResume --> Resume
		Resume r = new Resume();
		//r.setResume_id(resume_id); auto increase
		r.setResume_post_author("test");
		r.setEducation_level(tr.getEducation_level());
		r.setExpect_hy(tr.getExpect_hy());
		r.setExpect_post_category(tr.getExpect_post_category());
		r.setExpect_post_properties(tr.getExpect_post_properties());
		r.setExpect_post_salary(tr.getExpect_post_salary());
		r.setExpect_work_district_city(tr.getExpect_work_district_city());
		r.setExpect_work_district_prov(tr.getExpect_work_district_prov());
		r.setMajor_name(tr.getMajor_name());
		r.setSchool_name(tr.getSchool_name());
		r.setStudy_time(tr.getStudy_time_ys()+tr.getStudy_time_ds()+"-"+tr.getStudy_time_ye()+tr.getStudy_time_de());
		r.setWork_state(tr.getWork_state());
		r.setWork_experience(tr.getWork_experience_ename()+"#"+tr.getWork_experience_hytype()+"#"+tr.getWork_experience_pname()
		+"#"+tr.getWork_experience_ptype()+"#"+tr.getWork_experience_wys()+tr.getWork_experience_wds()+"-"+tr.getWork_experience_wye()
		+tr.getWork_experience_wde()+"#"+tr.getWork_experience_salary()+"#"+tr.getWork_experience_desc());
		
		//通过post_author 在用户表中查询sex age
		r.setSex("男");
		r.setAge("20");
		
		r.setWork_years("3");
		
		
		String rs = prs.resume_posting(r);
		
		
		
		return rs;
	}
}
